﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
    public partial class Outstanding_orders : Form
    {
        public Outstanding_orders()
        {
            InitializeComponent();
        }



        private void Outstanding_orders_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'inventoryDataSet.outstanding' table. You can move, or remove it, as needed.
            this.outstandingTableAdapter.Fill(this.inventoryDataSet.outstanding);
            // TODO: This line of code loads data into the 'inventoryDataSet_erp.outstanding' table. You can move, or remove it, as needed.
           
            // TODO: This line of code loads data into the 'inventoryDataSet_new.outstanding' table. You can move, or remove it, as needed.
           
           

            

            //   String getdte = "SELECT i.number,i.datex FROM invoice i,dealer dWHERE i.dealer_name=d.name ";
            //   DateTime gtedte = System.DateTime.Now;

               String getdte = "SELECT i.number,i.datex FROM invoice i,dealer dWHERE i.dealer_name=d.name ";
              // DateTime gtedte = System.DateTime.Now();


           
            ////  DateTime storedte = gtedte - getdte;
             
            //   SqlDataReader rdRccpv = DbConnet.ReadTable(getdte);


            //   while (rdRccpv.Read())
            //   {


            //       DateTime strdte=Convert["datex"];

                  // DateTime strdte=[datex];


            //   }


        }

        private void dataGridView3_MouseClick(object sender, MouseEventArgs e)
        {

            String invoiceno = dataGridView3.CurrentRow.Cells[1].Value.ToString();
            String stsat = dataGridView3.CurrentRow.Cells[5].Value.ToString();

            String invD = dataGridView3.CurrentRow.Cells[2].Value.ToString();
            DateTime id = DateTime.Parse(invD);
            int cd = 0;
            try
            {
                cd = int.Parse(dataGridView3.CurrentRow.Cells[4].Value.ToString());
            }
            catch (Exception ex)
            {
            }
            DateTime co = id.AddDays(cd);
            DateTime nw = DateTime.Now;

            Double rd = co.Subtract(nw).TotalDays;

            label2.Text = Math.Round(rd).ToString();
            lblName.Text = invoiceno;
        }
    }
}
